<%--
 *  File:    MonthSalesDataTwoDetail.jsp
 *  @Author: JackYin
 *  Date:    2011/07/01
--%>

<%@ include file="/inc/SessionTimeout.inc"%>
<%@ page language="java" %>     
<%@ page import="java.util.*" %>
<%@ page import="org.apache.log4j.Category" %>

<%@ page contentType = "text/html;charset=UTF-8" %>
<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/custom.tld" prefix="custom" %>
<% //--------------------------------------  setting logger --%>
<%
  	Category cat = Category.getInstance("jsp.MonthSalesDataTwoDetail"); 

	//init param
	String strModuleName = "COM";
	String privilegeCode = "ALL";
	String strTableName = "v_zylmonthsalesdatatwodetail";
	String contextPath = request.getContextPath();
%>
<% //--------------------------------------  include files list --%>
<%@ include file="/inc/FrmDefault.inc" %>
<%@ include file="/inc/PageDefault.inc" %>
<%@ include file="/inc/LocationDefault.inc" %>
<%@ include file="/rpt/ReportURL.inc" %>

<html>
<head>
<title>MonthSalesDataTwoDetail.jsp</title>
<PageFlow:CheckPageFlow pageName="p_zylmonthsalesdatatwodetail"/>
<link rel="stylesheet" href="<%=contextPath %>/css/<%= strLanguageCode %>/main.css" type="text/css">
<script language="JavaScript" src="<%=contextPath %>/css/<%= strLanguageCode %>/script.js"></script>
<script language="JavaScript" src="<%=contextPath %>/js/ScriptLib.js"></script>
<%@ include file="/inc/SummaryDivision.inc" %>
<%
Vector searchresults = (Vector)pageContext.getAttribute("searchresults");
if(searchresults == null) searchresults = new Vector();
%>
<script>
function page_summary(actionvalue,orderbyname){
	var editform = summaryPrepare(cform,actionvalue,orderbyname);
	editform.action = "MonthSalesDataTwoDetail.jsp?<%= OvalTools.randomURL() %>";
	editform.target = "_self";
	isRunning = true;
	editform.submit();  
}

function page_excel(){
	var sid = document.cform.salesdatafileid.value;	
	var searchname = document.cform.searchname.value;
	var searchvalue = document.cform.searchvalue.value;
	if(searchvalue=="" || searchvalue==null)searchvalue=-1;
 	window.location.href = "<%= reportURL %>/servlet/ExcecuteReport/MonthSalesDataTwoDetail.sox?__folder=/ovalreport&salesdatafileid="+sid+"&searchname=a."+searchname+"&searchvalue="+escape(encodeURI(searchvalue));
 }
 
function page_close(){
	window.close();
}

</script>
</head>
<body>
<% //--------------------------------------  page location --%>
<%@ include file="/inc/PageLocation.inc" %>
<table width="100%" cellspacing="0" border="0" cellpadding="0">
<form name="cform" method="post" action="<%=contextPath %>/Dispatcher"  target="_self">
	<input type="hidden" name="pagename" value="p_zylmonthsalesdatatwodetail">
	<input type="hidden" name="actionname">
    <custom:hidden property="salesdatafileid"></custom:hidden>
	<custom:hidden property="tip"></custom:hidden>
   <tr>
    <td> 
      <table width="100%" border="0" cellspacing="0">  
         <tr>
          	<td class="td_left"><%= label.getLabelName("L_filename") + label.getLabelName("L_Colon") %></td>
            <td>
            	<custom:write property="filename" name="filehash"/>
            </td>
        
         	<td class="td_left" ><%= label.getLabelName("L_TimePeriod") + label.getLabelName("L_Colon") %></td>
            <td>
         		<custom:write property="startdate" name="filehash"/>
         		-- 
         		<custom:write property="enddate" name="filehash"/>
            </td>
         	<td class="td_right" >&nbsp;</td>
         	<td>&nbsp;</td>
         </tr>
       </table>
        <tr>
    <td>
      <table width="100%" border="0" cellspacing="0">
        <tr>
          <td class="summary_top" width="10%" colspan="3"></td>
        </tr>
        <%@ include file="/inc/SummarySearch.inc" %>
      </table>
    </td>
  </tr>
    </td>
  </tr>
  <tr>
    <td colspan="2">
      <div style="width:100%;height=300;overflow=auto;">
      <table width="100%" border="1" cellpadding="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" cellspacing="0" align="center">
         <tr  class="deepblue-left">
         
            <td class="title_center"><%= label.getLabelName("L_Date")%></td>
           <!--
            	<td width="10%" class="title_center"><%= label.getLabelName("L_SendBusinessCode")%></td>
            -->
            <td class="title_center"><%= label.getLabelName("L_SendBusinessName") %></td>
            <td class="title_center"><%= label.getLabelName("L_CustomerBeforeName") %></td>
            <td class="title_center"><%= label.getLabelName("L_TerminalName") %></td>
			<td class="title_center"><%= label.getLabelName("L_Quantity") %></td>
            <td class="title_center"><%= label.getLabelName("L_ProdCode") %></td>
            <td class="title_center"><%= label.getLabelName("L_ProdName") %></td>
            <td class="title_center"><%= label.getLabelName("L_Spec") %></td>
            <td class="title_center"><%= label.getLabelName("L_OriginalflowDate") %></td>	
           
            	
         </tr>
         <%
             int i = 0;
             String strClassType = new String(); 
         
          %>
          <logic:iterate id="summary" collection="<%= searchresults %>">                      
         <%
            HashMap summaryMap = (HashMap)pageContext.getAttribute("summary");
            if(summaryMap == null) summaryMap = new HashMap();
            
            if(i%2 == 1){
              strClassType = "td-listrom";             
            }else{                    
              strClassType = "";
            }
              
            i++;     
          %>
           <tr onmouseover="this.className='tr-over'" onmouseout="this.className='<%=JspHelper.filterNull(strClassType)%>'" class="<%=JspHelper.filterNull(strClassType)%>">
           
           
            	<td><custom:write property="startdate" name="summary" dataType="date" dataFormat="yyyy-MM-dd"/></td>
         <!--
            <td><custom:write property="orgcode" name="summary"/></td>   -->
            <td><custom:write property="orgname" name="summary" nbsp="true"/></td>
            <td><custom:write property="custoriginame" name="summary" nbsp="true"/></td>
           
            	<td><custom:write property="partnername" name="summary" nbsp="true"/></td>
           <td><custom:write property="qty" name="summary" nbsp="true" /></td>
            <td><custom:write property="itemcode" name="summary" nbsp="true"/></td>
            <td><custom:write property="itemnamecn" name="summary" nbsp="true" /></td>
            <td><custom:write property="itemspec" name="summary" nbsp="true" /></td>
            <td><custom:write property="supplydate" name="summary" nbsp="true" /></td>
           
       
            
          </tr>
          </logic:iterate>
      <% //--------------------------------------  flipping page --%>
        <tr> 
	          <td colspan="4" style="text-align:right"><%=label.getLabelName("L_TotalSum") +  label.getLabelName("L_Colon")%></td>
				<td class="red"><b><custom:write name="sumhash" property="sumallqty" nbsp="true" dataType="number" dataFormatName="qtyviewformat" /></b></td>
				<td colspan="4">&nbsp</td>
	         <%@ include file="/inc/SummaryAction.inc" %>
	        </tr>
      </table>
	  </div>
      <table width="100%" cellspacing="0" cellpadding="0">
        <tr> 
          <td class="summary_top"></td>
        </tr>
        <tr> 
          <td class="td_center">
          <a onclick="page_excel();"><custom:button type="1" label="L_ExcelE" imgsrc="Modify.gif" border="0" style="width:100" privilegeCode="B0001"/></a>&nbsp;
            <a onclick="page_close();"><custom:button type="1" label="L_Close" imgsrc="edit.gif" border="0" style="width:80"/></a>
          </td>
        </tr>
      </table>
    </td>
  </tr>
  </form>
</table>
</body>
</html>